package com.apotik.legenda.frame;

import javax.swing.JFrame;

public class SecondFrame extends JFrame  {
	
	private JFrame mainFrame;
	
	public SecondFrame(JFrame mainFrame) {
	    initComponents();
	    this.mainFrame = mainFrame;
	}
	
	private void initComponents(){
	    //bind your own event for closing second frame
	    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
	    addWindowListener(new java.awt.event.WindowAdapter() {
	        public void windowClosing(java.awt.event.WindowEvent evt) {
	            formWindowClosing(evt);
	        }
	    });

	    /***********your stuff***************/
	}

	//show mainFrame when closing this frame and then dispose this frame
	private void formWindowClosing(java.awt.event.WindowEvent evt) {
	    mainFrame.setVisible(true);
	    this.dispose();
	}
	
}
